 document.onkeydown = function (e) {
      var theEvent = window.event || e;//兼容IE和FF
      var code = theEvent.keyCode || theEvent.which;
      if (code == 13) {
        submit_login('/Admin/index/checkLogin');
       }
    }   
    function checkEmail(email){ 
      var re = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
      var result = re.test(email); 
      return result;  
    } 
    function submit_login(url){
      var nickname = $('#nickname').val();
      var password = $('#upwd').val();
      var yzm = $('#yzm').val();
      var eInfo="";
      if(nickname!=null&&nickname!=""){
        if(password!=null&&password!=""){
           checkUser(url);
        }else{
          showInfo(1,'请输入密码。');
        }
      }else{  
        showInfo(1,'请输入用户名。');
      }
    }  
    function showInfo(status,message){
      var eInfo = $('#eInfo');
      var sInfo = $('#sInfo');
      if(status>0){
        eInfo.show();
      }else{
        eInfo.hide();
      }
      sInfo.text(message);
    } 
    function checkUser(url){ 
      var data = $("form").serialize(); 
      $.ajax({
        url: url,
        type: 'post',
        data: data,
        dataType: 'json',
        success:function(rData){
            if(rData.status>0){
              window.location.href=rData.url;
            }else{
              if(rData.isVerify){
                $('#isverify').removeClass('hide');
              }
              showInfo(1,rData.message);
            }
          }
      });  
    }
  function freshVerify() {  
    var verifyImg = $('#verifyImg');  
    var verifyImg_src = verifyImg.attr("src");  
    if( verifyImg_src.indexOf('?')>0){  
        verifyImg.attr("src", verifyImg_src+'&random='+Math.random());  
    }else{  
        verifyImg.attr("src", verifyImg_src.replace(/\?.*$/,'')+'?'+Math.random());  
    }  
  }  